JavaScript

String Class

Description

Methods to extend the native string variable. Polyfills have also been added to support substr with a negative index, trim, repeat, padStart and padEnd.

Methods

escapeRegExp Method

Extension to the native string variable to convert a string into a regular expression safe string.

extractFragment Method

Extension to the native string variable to support extraction of string fragments.

insertFragment Method

Extension to the native string variable to support insertion of fragments into a string.

padBoth Method

Extension to the native string variable to support padding both sides of a string equally - a combination of the native String.padStart and String.padEnd methods. By default the separators are white-space and punctuation characters.

toBool Method

Extension to the native string variable to convert a string into a boolean.

toCase Method

Extension to the native string variable to convert a string into a given case.

toDate Method

Extension to the native string variable to convert a string into a date.

toNumber Method

Extension to the native string variable to convert a formatted string into a number.

trimChars Method

Extension to the native string variable to trim characters from the start and/or end of the string.